<?php
include("template_top.php");
if(isset($_GET['iID'])){
    $sql = "UPDATE  `tbCows` SET `sSoft` = :soft, `sHard` = :sHard, `sCompName` = :compname, `sLKL` = :sLKL, `sOS` = :sOS, `sUpdateBy` = :name, `sUpdate` = :update WHERE `iID` = :id";
    //echo $sql;
	db::Query($sql, array(':soft'=>$_GET['sSoft'], ':sHard'=>$_GET['sHard'], ':compname'=>$_GET['sCompName'], ':sLKL'=>$_GET['sLKL'], ':sOS'=>$_GET['sOS'], ':name'=>$USER['sFname']." ".$USER['sLname'], ':update'=>date("F n, Y @ g:i A"), ':id'=>$_GET['iID']));
}
$sql = "SELECT * FROM tbCows ORDER BY `sName` ASC";
$COWS = db::Query($sql);
?>
<h1>COW Tracker</h1>
<?php while($row = $COWS->fetch()) { ?>
    <b><?php echo $row['sName'] ?> - <a href="Update_Cow.php?cow=<?php echo $row['iID'] ?>">UPDATE</a></b><br/>
    &nbsp;&nbsp;&nbsp;<b>Computer Name:</b><br/>
    <div style='margin-left:15px;'><?php echo $row['sCompName'] ?></div>
    &nbsp;&nbsp;&nbsp;<b>Last Known Location:</b><br/>
    <div style='margin-left:15px;'><?php echo $row['sLKL'] ?></div>
    &nbsp;&nbsp;&nbsp;<b>Last Updated By:</b><br/>
    <div style='margin-left:15px;'><?php echo $row['sUpdateBy'] ?></div>
    &nbsp;&nbsp;&nbsp;<b>Last Updated:</b><br/>
    <div style='margin-left:15px;'><?php echo $row['sUpdate'] ?></div>
    &nbsp;&nbsp;&nbsp;<b>Operating System:</b><br/>
    <div style='margin-left:15px;'><?php echo $row['sOS'] ?></div>
    &nbsp;&nbsp;&nbsp;<b>Software:</b><br/>
    <div style='margin-left:15px;'><?php echo $row['sSoft'] ?></div>
    &nbsp;&nbsp;&nbsp;<b>Hardware:</b><br/>
    <div style='margin-left:15px;'><?php echo $row['sHard'] ?></div><br/><br/><br/>
<?php } ?>